const express = require('express');
var merchantController = require('../controller/merchant.controller');

module.exports = (app)=>{
    var router = express.Router();

    router.route('/')
        .post(merchantController.addMerchant)
        .put(merchantController.updateMerchent)
        .get(merchantController.findAll);

    router.route('/:id')
        .get(merchantController.findMerchantById);

    router.route('/status/:status')
        .get(merchantController.findMerchantByStatus);

    app.route('/merchants/getStatus/:id')
        .get(merchantController.findStatusById);

    app.route('/merchants/ban/:ban')
        .get(merchantController.findMerchantByBan);

    router.route('/status')
        .put(merchantController.updateStatusById);

    router.route('/ban')
        .put(merchantController.updateBanById);

    app.use('/sec/merchants',router);

    return router;
}